1. Field of the Invention
The method for detecting video frame types with Median Filtering denoising step to distinguish comb factor from impure spots, then to determine frame types and improve detection accuracy.
2. Description of the Prior Art
The video picture that is commonly adopted at present is transmitted at 30 frames per second to produce continuous and dynamic images. Each frame consists of a plurality of scan lines (for instance, National Television System Committee—NTSC, standard is 525 scan lines). That is, 525 scan lines are transmitted in 1/30 second for one frame.
Said video frame is classified into two categories: interlaced frame and progressive frame. Scanning of the interlaced frame divides each frame into a top field and a bottom-field. The top field has an odd number of scan lines while the bottom-field has an odd number of scan lines. They are separately scanned at two times. For instance, the top-field is scanned first, then the-bottom field is scanned to generate a complete frame. For the progressive frames, all of the scanning lines are transmitted at the same time, so they are scanned consequentially individually one after one.
Referring to FIG. 1(a) and 1(b) for an interlaced frame 10 and a progressive frame 11. As the interlaced frame 10 is scanned at different times and is transmitted respectively for the top field (even number of scan lines) and the bottom-field (odd number of scan lines), a comb-shaped pattern is generated on the peripheral edges of the square picture 100 and the triangle picture 101 (generally called comb factor). The resolution is less desirable and video quality is poorer. While the whole progressive frame 11 is transmitted at the same time, therefore the comb factor as shown in FIG. 1(a) does not occur.
Based on previous discussion, it is obvious that the comb factor has great impact on resolution. Hence prior to video output, a detection process is performed to determine whether the input frame is an interlaced frame or a progressive frame. If the interlaced frame is detected, then a deinterlacing process is conducted to remove the comb factor to obtain a higher quality video. If the progressive frame is detected, the video may be directly output without deinterlacing.
Referring to FIG. 2 for a traditional detection process. First, in step 201, set the comb factor counter to be zero and input a frame F (n) for calculating the comb factor of pixels; then, in step 202, apply all of the pixels to the frame function F (n); in step 203, calculate the comb factor of the pixels (the equation for calculating the comb factor will be discussed later); in step 204, determine whether the comb factor is above the threshold value; if “yes”, come to step 205 and increase the counter value by one; if “no”, come to step 206 to determine if it is the last comb factor; if it is, come to step 207; if “no”, repeat step 203 to step 206; in step 207, determine whether the value in the counter is less than the threshold value; if yes, the frame is determined as a progressive frame at step 208; if no (i.e. the counter value is more than the threshold value), come to step 209 and determine the frame as an interlaced frame; finally end the detection process.
FIG. 3 illustrates the calculation of a pixel comb factor in step 203 shown in FIG. 2. The pixel 30 to be calculated is located on the coordinate X in the picture. O-31 indicates a first adjacent pixel (b) and O-32 indicates a second adjacent pixel (e), then the equation for calculating the comb factor of the pixel 30 is as follows:Comb Factor (x, y)=(b−x)×(e−x)−(b−e)2   (Eq. 1)
Of which, x is the pixel value of pixel 30 on the coordinate (x, y); b is the pixel value of the first adjacent pixel 31 on coordinate (x, y−1); e is the pixel value of the second adjacent pixel 32 on coordinate (x, y+1).
Though a pixel could be determined whether it is a comb factor by comparing the value of each comb factor figured out with the formula with a fixed threshold value, then the type of the frame could be determined by the number of the comb factors (the number of the counters), this method sometimes still leads to wrong judgments. The reason is that when a pixel is greatly different from surrounding pixels in brightness, the comb factor value calculated with above formula shall be very big, so if there are some impure spots on videos, they may be wrongly determined to be comb factors due to the difference in brightness. For instance, if there are more impure spots on progressive frame videos, they may be wrongly determine to be interlaced frames.
To solve the above mentioned problems, a method for detecting frame types with Median Filtering is offered in this invention, thus a more precise way of judging interlaced frames and progressive frames is available.